<h1>PIB Document</h1>
<?php 
    if($pib){$data = 
        $pib['data'];$lineitems = $pib['lineitem'];
        $tempsession = $this->session->userdata('user');
    ?>
<fieldset>
<legend>Data</legend>
<table>
    <tr>
        <td><label>Custom Office</label></td>
        <td><label><?php echo $data->CustomOffice;?></label></td>
        <td>PIB Number</td>
        <td><label><?php echo $data->PIBNo;?></label></td>
    </tr>
    <tr>
        <td><label>Kind Of PIB</label></td>
        <td><label><?php echo $data->KindofPIB;?></label></td>
        <td>Kind of Import</td>
        <td><label><?php echo $data->KindofImport;?></label></td>
    </tr>
    <tr>
        <td><label>Payment</label></td>
        <td><label><?php echo $data->Payment;?></label></td>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td>PPJK</td>
        <td><label><?php echo $data->PPJKName;?></label></td>
        <td>Consignor</td>
        <td><label><?php echo $data->CoName;?></label></td>
    </tr>
    <tr>
        <td></td>
        <td><label><?php echo $data->PPJKNPWP;?></label></td>
        <td></td>
        <td><label><?php echo $data->CoAddress;?></label></td>
    </tr>
    <tr>
        <td></td>
        <td><label><?php echo $data->PPJKNumber;?></label></td>
        <td></td>
        <td><label><?php echo $data->CoTelp;?></label></td>
    </tr>
    <tr>
        <td></td>
        <td><label><?php echo $data->PPJKDatePermission;?></label></td>
        <td></td>
        <td><label></label></td>
    </tr>
    <tr>
        <td>Consignee</td>
        <td><label><?php echo $data->CName;?></label></td>
        <td></td>
        <td><label><?php echo $data->CAddress;?></label></td>
    </tr>
    <tr>
        <td></td>
        <td><label><?php echo $data->CTelp;?></label></td>
        <td></td>
        <td><label><?php echo $data->CStatus;?></label></td>
    </tr>
    <tr>
        <td>Transportation</td>
        <td><label><?php echo $data->Transportation;?></label></td>
        <td>Transportation Voyage No</td>
        <td><label><?php echo $data->TransportationVoyageNo;?></label></td>
    </tr>
    <tr>
        <td>Arrival Date</td>
        <td><label><?php echo $data->ArrivalDate;?></label></td>
        <td>Loading Dock</td>
        <td><label><?php echo $data->LoadingDock;?></label></td>
    </tr>
    <tr>
        <td>Transit Dock</td>
        <td><label><?php echo $data->TransitDock;?></label></td>
        <td>Discharge Dock</td>
        <td><label><?php echo $data->DischargeDock;?></label></td>
    </tr>
    <tr>
        <td>Brand Container</td>
        <td><label><?php echo $data->BrandContainer;?></label></td>
        <td>Gross Weight</td>
        <td><label><?php echo $data->GrossWeight;?></label></td>
    </tr>
    <tr>
        <td>Nett Weight</td>
        <td><label><?php echo $data->NettWeight;?></label></td>
        <td></td>
        <td><label></label></td>
    </tr>
</table>
</fieldset>
<fieldset>
<legend>Container</legend>
    <table>
        <tr>
            <td>Container No</td>
            <td>Kind Package</td>
            <td>Gross Weight</td>
            <td>Nett Weight</td>
            <td>Measurement</td>
            <td>Detail</td>
            <td>Total Package</td>
        </tr>
        <?php foreach($lineitems as $lineitem){ 
            $containerdetails = $lineitem->ContainerDetail?>
        <tr>
            <td><?php echo $lineitem->ContainerNo;?></td>
            <td><?php echo $lineitem->KindPackage;?></td>
            <td><?php echo $lineitem->GrossWeight;?></td>
            <td><?php echo $lineitem->NettWeight;?></td>
            <td><?php echo $lineitem->Measurement;?></td>
            <td>
               <?php foreach($containerdetails as $containerdetail){
                   echo $containerdetail->QuantityPackage. ' '.$containerdetail->Description;
                   echo '</br>';
               }?>
            </td>
            <td><?php echo $lineitem->TotalPackage;?></td>
        </tr>
        <?php } ?>
    </table>
</fieldset>
<fieldset>
<table>
    <?php if($data->ApprovementStatus!=ACTION_APPROVE && $tempsession['role_id']==ROLE_INSW){
    ?>
    <tr>
        <td>Approvement :</td>
        <td></td>
    </tr>
    <tr>
        <td><form action="<?php echo base_url().'message/update_approvement'?>" method="POST"><input type="hidden" name="role_document" value="<?php echo DOCUMENT_PIB;?>" /><input type="hidden" name="document_id" value="<?php echo $data->pib_id;?>" /><input type="hidden" name="action" value="<?php echo ACTION_APPROVE;?>" /><input id="formloginbutton" type="submit" value="Approve" /></form></td>
        <td><form action="<?php echo base_url().'message/update_approvement'?>" method="POST"><input type="hidden" name="role_document" value="<?php echo DOCUMENT_PIB;?>" /><input type="hidden" name="document_id" value="<?php echo $data->pib_id;?>" /><input type="hidden" name="action" value="<?php echo ACTION_REJECT;?>" /><input id="formloginbutton" type="submit" value="Reject" /></form></td>
    </tr>
        <?php }else{ if($data->ApprovementStatus==ACTION_NOACTION){$action='Not approved yet';}else if($data->ApprovementStatus==ACTION_APPROVE){$action='Approved';}else if($data->ApprovementStatus==ACTION_REJECT){$action='Rejected';}?>
    <tr>
        <td><label>Approvement :</label></td>
        <td><label><?php echo $action;?></label></td>
    </tr>
        <?php } ?>
</table>
</fieldset>
<br/>
<br/>
<?php } ?>